package people.paper.tv.receiver.vc;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class VoiceControllerReceiver extends BroadcastReceiver {

    private static final String VOICE_ACTION = "com.skyworth.srtnj.action.voice.outcmd";

    private static final String VOICE_TEST_ACTION = "com.skyworth.srtnj.action.voice.outcmd.test";
    private static final String KEY_DATA = "voicecmd";

    @Override
    public void onReceive(Context context, Intent intent) {
        if (VOICE_ACTION.equals(intent.getAction())) {
            String voiceData = intent.getStringExtra(KEY_DATA);
            VoiceControllerProcessor.process(context, voiceData);
        } else if (VOICE_TEST_ACTION.equals(intent.getAction())) {
            String index = intent.getStringExtra(KEY_DATA);
            VoiceControllerProcessor.process(context, Integer.valueOf(index));
        }
    }
}
